package com.lonni.rpc.core.spirng;

import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
import org.springframework.core.type.filter.AnnotationTypeFilter;

import java.lang.annotation.Annotation;

/**
 * @author: lonni
 * @CreateTime: 2024-06-27  22:36
 * @Description:
 */
public class RpcSpringScanner extends ClassPathBeanDefinitionScanner {
    public RpcSpringScanner(BeanDefinitionRegistry registry, Class<? extends Annotation> annoType) {
        //传递 spring容器,默认不加载spring默认注解
        super(registry,false);
        //添加条件过滤器,只有annoType注解的才会被加载
        super.addIncludeFilter(new AnnotationTypeFilter(annoType));
    }

    @Override
    public int scan(String... basePackages) {
        return super.scan(basePackages);
    }


}
